import  axios from '../utils/http'
//普通登录
export function getLogin(user,passWord) {
    let obj=new URLSearchParams()
    obj.append('username',user)
    obj.append('password',passWord)
    obj.append('rememberMe',true)
    return axios.post(`/api/pcUser/login`,obj)
}
//获取验证码
export function getCode(mobile) {
    return axios.get(`/api/pcUser/login/send/code/${mobile}`)
}
//验证码登录
export function codeLogin(mobile,code) {
    let obj=new URLSearchParams()
    obj.append('mobile',mobile)
    obj.append('code',code)
    obj.append('rememberMe',true)
    return axios.post(`/api/pcUser/login/mobile`,obj)
}
//修改密码时发送手机验证码
export function forgetCode(loginName,mobile) {
    let obj=new URLSearchParams()
    obj.append('loginName',loginName)
    obj.append('mobile',mobile)
    return axios.post(`/api/pcUser/forgetpassword/send/code`,obj)
}
//修改密码
export function updateCode(loginName,password,mobile,code) {
    // dataForget={
    //     "loginName":loginName,
    //     "password":password,
    //     "mobile":mobile,
    //     "code":code
    // }
    // return axios.post(`/api/pcUser/password/forget`,obj)
    return axios({
        url:"/api/pcUser/password/forget",
        method:"post",
        data:{
            "loginName":loginName,
            "password":password,
            "mobile":mobile,
            "code":code
        }
    })
}